﻿package Part_2_work;

import java.util.Scanner;

public class J_Length {
	public static void main(String[] args) {
		String userName,pwd,pwdRe;
		while(true){
			Scanner sc = new Scanner(System.in);
			System.out.print("请输入用户名：");
			userName = sc.next();
			System.out.print("请输入密码：");
			pwd = sc.next();
			System.out.print("请再次输入密码：");
			pwdRe = sc.next();
			if(userName.length() >= 3 && pwd.length() >= 6 && pwd.equals(pwdRe)){
				System.out.println("登录成功！请牢记用户名和密码！");
				break;
			}else if(userName.length() < 3 && pwd.length() >= 6 && pwd.equals(pwdRe)){
				System.out.println("用户名长度不能低于三位！");
			}else if(userName.length() >= 3 && pwd.length() < 6 && pwd.equals(pwdRe)){
				System.out.println("密码长度不能低于六位！");
			}else if(userName.length() >= 3 && pwd.length() >= 6 && !pwd.equals(pwdRe)){
				System.out.println("密码两次输入不一致！");
			}
		}
	}
}
